//==========================================================================
// Copyright (c) 2000-2008,  Elastos, Inc.  All Rights Reserved.
//==========================================================================
//common.h
#ifndef _COMMON_H
#define _COMMON_H

#define GUIAPI

//typedef void *PVoid;//elatypes.h
typedef void *HGDIOBJ;

//already defined in elacent.h
#ifndef _WINDEF_

//#ifdef STRICT
//#define DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name;
//#else
#define DECLARE_HANDLE(name) typedef PVoid name
//#endif

#endif


#ifndef __objidl_h__
DECLARE_HANDLE(HDC);
DECLARE_HANDLE(HWND);
DECLARE_HANDLE(HBRUSH);
DECLARE_HANDLE(HPEN);
//DECLARE_HANDLE(HFONT);
DECLARE_HANDLE(HBITMAP);
DECLARE_HANDLE(HICON);
//DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HRGN);

DECLARE_HANDLE(HMENU);
DECLARE_HANDLE(HACCEL);
DECLARE_HANDLE(HCURSOR);

typedef UInt32 WPARAM;
typedef Int32 LPARAM;


typedef struct tagPOINT {
    int x;
    int y;
} POINT, *PPOINT;

typedef struct tagRECT {
    int left;
    int top;
    int right;
    int bottom;
} RECT, *PRECT;

typedef struct tagSIZE {
    int cx;
    int cy;
} SIZE, *PSIZE;
#endif

#ifndef MIN
#define MIN(x, y)           ((x < y)?x:y)
#endif

#ifndef MAX
#define MAX(a,b)      ((a) > (b) ? (a) : (b))
#endif

/**
 * \def LOSWORD(l)
 * \brief Returns the low signed word of the double word \a l
 *
 * \sa MAKELONG
 */
#define LOSWORD(l)          ((signed short)(UInt32)(l))
/**
 * \def HISWORD(l)
 * \brief Returns the high signed word of the double word \a l
 *
 * \sa MAKELONG
 */
#define HISWORD(l)          ((signed short)((((UInt32)(l)) >> 16) & 0xFFFF))


//#define __DEBUGAL__

#ifndef __DEBUGAL__
#undef printf
#define printf
#endif

#endif
